package fri.pipt.agent.deathrow.path;

import fri.pipt.agent.deathrow.Pos2;

public class PathNode implements Comparable<PathNode>
{
	public boolean obiskan = false;
	public Pos2		pos;		// Kje se nahaja node
	public int			dist;		// Kakšna je razdalja do sem
	public PathNode	previous;	// Kateri node je njegov predhodnik

	public PathNode(Pos2 pos)
	{
		this(pos,0);
	}
	
	public PathNode(Pos2 pos, int distance)
	{
		this(pos, distance, null);
	}
	
	public PathNode(Pos2 pos, int distance, PathNode previous)
	{
		this.previous = previous;
		this.pos = new Pos2(pos);
		this.dist = distance;
	}
	
	@Override
	public int compareTo(PathNode o)
	{
		return dist - o.dist;
	}
	
	@Override
	public String toString()
	{
		return "dist: " + this.dist + " " + this.pos;
	}
	
	@Override 
	public boolean equals(Object o)
	{
		if(o instanceof PathNode)
		{
			return ((PathNode) o).pos.equals(pos);
		}
		return false; 
	}
}
